]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
background: Fix updating existing images that need loading
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 14 Mar 2013 17:59:30 +0000 (13:59 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 14 Mar 2013 21:48:07 +0000 (17:48 -0400)
Due to weird and strange JS scoping semantics, if we are in a
callback, "i" won't be captured and when the callback is called,
we'll have the wrong index, causing addImage to be called instead
of updateImage.

https://bugzilla.gnome.org/show_bug.cgi?id=695882

js/ui/background.js

index bb1b2f8d05618a53585c857357065277e62c7bbc..9e3e0099dc11394b4e704e557dc8d368096a0c78 100644 (file)
@@ -407,7 +407,7 @@ const Background = new Lang.Class({
                                           style: this._style,
                                           filename: files[i],
                                           cancellable: this._cancellable,
-                                          onFinished: Lang.bind(this, function(content) {
+                                          onFinished: Lang.bind(this, function(content, i) {
                                               numPendingImages--;
 
                                               if (!content) {
@@ -427,7 +427,7 @@ const Background = new Lang.Class({
                                                   this._setLoaded();
                                                   this._updateAnimationProgress();
                                               }
-                                          })
+                                          }, i)
                                         });
         }
     },